<template>
<div>
  
  <BrowseDataList
    :cols="cols"
      :fetchData="fetchData"
   
  />
</div>
</template>
<script>
import BrowseDataList from "@/components/BrowseDataList2";
import { getUser } from "@/utils/auth";
import { getAlfx } from "@/api/案例分析.js";
import { getMc } from "@/api/名称.js";
import linq from "linq";
export default {
  components: {
    BrowseDataList
  },
  data() {
    return {
      cols: [
        { label: "指标名称", prop: "指标名称" },
        { label: "本院校数据", prop: "本院校数据" },
        { label: "评估指标", prop: "评估指标" },
      ]
    };
  },
  methods: {
    async fetchData() {
      var user = getUser();
      var datas = await getAlfx(user.XXID, user.CJPC);
      var rows =[];
      var data = await getMc(user.XXID,user.CJPC)
      var school = data[0];
      
      var stardard = {
          "01综合大学":[
              18,15,14,4000,80,20,54,6.5,5.3,8,7,10,3
          ],
          "02理工院校":[
              18,15,16,4000,60,20,59,6.5,8.3,10,7,10,2
          ],
          "03农业院校":[
              18,15,16,4000,60,20,59,6.5,8.8,10,7,10,2
          ],
          "04林业院校":[
              18,15,16,4000,60,20,59,6.5,8.8,10,7,10,2
          ],
          "05医药院校":[
              16,15,16,4000,60,20,59,6.5,9,10,7,10,2
          ],
          "06师范院校":[
              18,15,14,4000,80,20,54,6.5,5.3,10,7,10,3
          ],
          "07语文院校":[
              18,15,9,3000,80,20,54,6.5,1.05,10,7,10,3
          ],
          "08财经院校":[
              18,15,9,3000,80,20,54,6.5,1.05,10,7,10,3
          ],
          "09政法院校":[
              18,15,9,3000,80,20,54,6.5,1.05,10,7,10,3
          ],
          "10体育院校":[
              13,15,22,3000,50,20,88,6.5,1.85,10,7,10,2
          ],
          "11艺术院校":[
              13,15,18,3000,60,20,88,6.5,1.85,10,7,10,3
          ],
          "12民族院校":[
              18,15,14,4000,80,20,54,6.5,5.3,10,7,10,3
          ],
      }
      datas.forEach(item=>{
          if(item.XMMC == '生师比')
          {
              rows.push({指标名称:'生师比',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][0]});
          }
          if(item.XMMC == '具有研究生学位教师占专任教师的比例')
          {
                rows.push({指标名称:'具有研究生学位教师占专任教师的比例',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][1]})
          }
          if(item.XMMC == '生均教学行政用房')
          {
                rows.push({指标名称:'生均教学行政用房（平方米/生）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][2]})
          }
          if(item.XMMC == '生均(折合)教学科研仪器设备值'){
             rows.push({指标名称:'生均教学科研仪器设备值（元/生）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][3]})
          }
          if(item.XMMC == '生均(折合)图书'){
               rows.push({指标名称:'生均图书（册/生）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][4]})
          }
          if(item.XMMC == '专业技术职务结构_高级_比例'){
 rows.push({指标名称:'具有高级职务教师占专任教师的比例（%）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][5]})
          }
          if(item.XMMC == '生均占地面积'){
rows.push({指标名称:'生均占地面积（平方米/生）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][6]})
          }
           if(item.XMMC =='生均学生宿舍(公寓)面积'){
rows.push({指标名称:'生均宿舍面积（平方米/生）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][7]})
           }
           
           if(item.XMMC =='百名学生配教学用计算机台数'){
rows.push({指标名称:'百名学生配教学用计算机数（台）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][9]})
           }
             if(item.XMMC =='新增教学科研仪器设备所占比例'){
rows.push({指标名称:'新增科研仪器设备所点比例（%）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][11]})
           }
           if(item.XMMC =='生均(折合)年进书量'){
rows.push({指标名称:'生均年进书量（册）',本院校数据:item.SZ,评估指标:stardard[school.XZ_XXXZM][12]})
           }
         
      })
      var sz = linq.from(datas).firstOrDefault(`$.XMMC =='教学科研及辅助用房_实验实习场所_面积'`);
      var num = linq.from(datas).firstOrDefault(`$.XMMC =='学生情况_折合在校生数'`); 
      
      rows.push({指标名称:'生均实践场所（平方米/生）',本院校数据:(sz.SZ/num.SZ).toFixed(2),评估指标:stardard[school.XZ_XXXZM][8]})
      
      return rows;
    }
  }
};
</script>
<style>
</style>